﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUS;
using DTO;

namespace LibraryManager
{
    public partial class DangNhap : Form
    {
        public DangNhap()
        {
            InitializeComponent();
        }

        private void Login_Click(object sender, EventArgs e)
        {
            int sh;
            string id = "";
            DangNhapDTO lg = new DangNhapDTO();
            lg.Username = Username.Text;
            lg.Password = Password.Text;
            sh = DangNhapBUS.DangNhap(lg, ref id);

            switch (sh)
            {
                case 1:
                    {
                        DocGia rdr = new DocGia();
                        Hide();
                        rdr.Show();
                        break;
                    }
                case 2:
                    {
                        ThuThu lib = new ThuThu(id);
                        Hide();
                        lib.Show();
                        break;
                    }
                case 3:
                    {
                        ThuKho skp = new ThuKho(id);
                        Hide();
                        skp.Show();
                        break;
                    }
                case 4:
                    {
                        QuanLy mgr = new QuanLy();
                        Hide();
                        mgr.Show();
                        break;
                    }
            }
        }

        private void Exit_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
